package cn.skyquant.quant4j.service.boot.model.authority;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;

/**
 * 角色
 * Created by harley-dog on 2016/5/12.
 */
@Entity
public class Role implements Serializable{
    private static final long serialVersionUID = 1L;

    public final static Role administrator = new Role("administrator");
    public final static Role client = new Role("client");
    public final static Role guest = new Role("guest");

    @Id
    public String name;

    public Role() {
    }

    public Role(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Role)) return false;
        Role role = (Role) o;
        return Objects.equals(name, role.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }
}
